package cn.iocoder.yudao.module.shop.convert.handlestrategyuser;

import java.util.*;

import cn.iocoder.yudao.framework.common.pojo.PageResult;

import cn.iocoder.yudao.framework.common.util.collection.CollectionUtils;
import cn.iocoder.yudao.module.shop.dal.dataobject.handlestrategy.ShopHandleStrategyDO;
import org.mapstruct.Mapper;
import org.mapstruct.factory.Mappers;
import cn.iocoder.yudao.module.shop.controller.admin.handlestrategyuser.vo.*;
import cn.iocoder.yudao.module.shop.dal.dataobject.handlestrategyuser.ShopHandleStrategyUserDO;

/**
 * 艾灸师绑定的工资策略 Convert
 *
 * @author 曹建伟
 */
@Mapper
public interface ShopHandleStrategyUserConvert {

    ShopHandleStrategyUserConvert INSTANCE = Mappers.getMapper(ShopHandleStrategyUserConvert.class);

    ShopHandleStrategyUserDO convert(ShopHandleStrategyUserCreateReqVO bean);

    ShopHandleStrategyUserDO convert(ShopHandleStrategyUserUpdateReqVO bean);

    ShopHandleStrategyUserRespVO convert(ShopHandleStrategyUserDO bean);

    List<ShopHandleStrategyUserRespVO> convertList(List<ShopHandleStrategyUserDO> list);

    PageResult<ShopHandleStrategyUserRespVO> convertPage(PageResult<ShopHandleStrategyUserDO> page);

    List<ShopHandleStrategyUserExcelVO> convertList02(List<ShopHandleStrategyUserDO> list);

    default List<ShopHandleStrategyUserRespVO> convertList(List<ShopHandleStrategyUserDO> userList, List<ShopHandleStrategyDO> strategyList){
        List<ShopHandleStrategyUserRespVO> list = convertList(userList);

        Map<Long, ShopHandleStrategyDO> strategyDOMap = CollectionUtils.convertMap(strategyList, ShopHandleStrategyDO::getId);
        for(int i = 0; i<list.size(); i++){
            ShopHandleStrategyUserRespVO item = list.get(i);
            item.setStrategy(strategyDOMap.get(item.getStrategyId()));
        }

        return list;
    }

}
